package org.example.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope
@RequestMapping("/config")
public class ConfigController {
    /**
     * 在读取nacos中的配置的时候要注意我们需要将application name和dataId相等
     */
    @Value("${nacos.test.num}")
    //造成的问题就是他不会读取命名空间的配置
    private Integer configNum;
    @RequestMapping("/getConfig")
    public Integer getConfigNumD() {
        return  configNum;
    }
}
